<template>
  <a-card :bordered="false" class="card-area">
      <!-- 表格区域 -->
      <a-table
        ref="TableInfo"
        :columns="columns"
        :rowKey="
          (record, index) => {
            return index;
          }
        "
        :dataSource="dataSource"
        :pagination="pagination"
        :loading="loading"
        @change="pageChange"
        @showSizeChange="pageChange"
        :scroll="{ x: 1400 }"
      >
      </a-table>
  </a-card>
</template>

<script>

export default {
  name: "FeeTable",

  data() {
    return {
      beanInfo: {},
      instId: '',
      queryParams: {},
      dataSource: [],
      loading: false,
      pagination: {
        pageNum: 1,
        pageSize: 10,
        pageSizeOptions: ["10", "20", "30", "40", "100"],
        defaultCurrent: 1,
        defaultPageSize: 10,
        showQuickJumper: true,
        showSizeChanger: true,
        showTotal: (total, range) =>
          `显示 ${range[0]} ~ ${range[1]} 条记录，共 ${total} 条记录`,
      },
    };
  },
  computed: {
   columns() {
      return [
        {
          title: "法人行",
          dataIndex: "instId",
          width: 100,
        },
        {
          title: "收单机构",
          dataIndex: "manageInstId",
          width: 150,
        },
        {
          title: "商户号",
          dataIndex: "mchntNo",
          width: 160,
        },
        {
          title: "商户名称",
          dataIndex: "mchntName",
          width: 150,
        },
        {
          title: "最后修改人",
          dataIndex: "lastOprId",
          width: 170,
        },
        {
          title: "最后修改时间戳",
          dataIndex: "lastUpdateTime",
          width: 150,
        },
        {
          title: "最后审核人",
          dataIndex: "lastAuditId",
          width: 170,
        },
        {
          title: "最后审核时间",
          dataIndex: "lastAuditTime",
          width: 150,
        },
        {
          title: "操作",
          dataIndex: "bizOpr",
          width: 150,
          customRender (text) {
            return text ? {
              "I": "新增",
              "U": "修改",
              "D": "停用",
              "E": "启用",
              "C": "注销",
              "P": "审批通过",
              "R": "审批退回",
            }[text] : ""
          }
        },
        {
          title: "执行操作内容",
          dataIndex: "bizChangeData1",
          width: 500,
        },
      ];
    },
  },

  methods: {
    setBeanInfo({...beanInfo},instId){
      this.beanInfo = beanInfo;
      this.instId = instId;
      this.search();
    },
    async search(){
      try {
        const res = await this.$get("/admin/mcmp/bMchntBaseInfo/listHis", {
          instId: this.instId,
          mchntNo: this.beanInfo.mchntNo,
          pageNum: this.pagination.pageNum,
          pageSize: this.pagination.pageSize,
        });
        this.dataSource = res.data.rows;
        this.$set(this.pagination, "total", +res.data.total);
      } catch (e) {
        console.error(e);
      }
    },
    pageChange(e) {
      this.pagination.pageNum = e.current;
      this.pagination.pageSize = e.pageSize;
      this.search();
    },
  },
};
</script>
<style lang="less" scoped>
@import "../../../../../static/less/Common";
</style>
